﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MastePage/SubEmptyMaster.Master" AutoEventWireup="true" CodeBehind="QueryMMaterialByReturnMat.aspx.cs" Inherits="BySoft.Web.Site.ComPage.QueryMMaterialByReturnMat" %>

<%@ Register Assembly="OneSoft.Web" Namespace="OneSoft.Web.UI.WebControls" TagPrefix="asp" %>
<%@ Register Assembly="BySoft.Web.Controls" Namespace="BySoft.Web.Controls" TagPrefix="cc1" %>
<asp:Content ID="cphContent" runat="server" ContentPlaceHolderID="EmptyMasteCPH">
    <script language="javascript" type="text/javascript">
        function CheckAll(con) {
            var dom = document.getElementById("<%=grdResult.ClientID %>").getElementsByTagName("*");

            for (i = 0; i < dom.length; i++) {
                if (dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox") {
                    dom[i].checked = document.getElementById(con.id).checked;
                }
            }
        }

        function CheckSingle(con) {
            var dom = document.getElementById("<%=grdResult.ClientID %>").getElementsByTagName("*");
            if (!document.getElementById(con.id).checked) {
                for (i = 0; i < dom.length; i++) {
                    if (dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox") {
                        dom[i].checked = false;
                        break;
                    }
                }
            }
            else {
                var choose = true;
                var first = true;
                for (i = 0; i < dom.length; i++) {
                    if (dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox") {
                        if (first == false) {
                            if (dom[i].checked == false) {
                                choose = false;
                                break;
                            }
                        }
                        else {
                            first = false;
                        }
                    }
                }

                for (i = 0; i < dom.length; i++) {
                    if (dom[i].tagName == "INPUT" && dom[i].type.toLowerCase() == "checkbox") {
                        dom[i].checked = choose;
                        break;
                    }
                }
            }
        }
    </script>

    <div>
        <div class="tableStyle2">
            <table cellpadding="0" cellspacing="0">
                <tr>
                    <th class="left2">原料编号：
                    </th>
                    <td class="right2">
                        <asp:TextBox CssClass="fullWidth" ID="txtMaterialID" runat="server"></asp:TextBox>
                    </td>
                    <th class="left2">原料品名：
                    </th>
                    <td class="right2">
                        <asp:TextBox CssClass="fullWidth" ID="txtMaterialName" runat="server"></asp:TextBox>
                    </td>
                </tr>
            </table>
            <div class="controlBar">
                <label class="btnStyleb png_bg">
                    <asp:Button Text="查询" runat="server" ID="btnQuery" OnClick="btnQuery_Click" CssClass="png_bg" />
                </label>
            </div>
            <br />
        </div>
        <asp:HiddenField ID="hdScheduleDetailID" runat="server" />
        <asp:HiddenField ID="hdID" runat="server" />
        <div class="tableStyle">
            <asp:SGridView runat="server" ID="grdResult" Width="100%" ShowActionToolBar="false"
                AutoGenerateColumns="false" AllowCascade="false" BorderWidth="0px" GridLines="None">
                <Columns>
                    <asp:TemplateField ControlStyle-Width="30px" ItemStyle-Width="30px">
                        <HeaderTemplate>
                            <asp:CheckBox ID="cbAll" runat="server" onclick="CheckAll(this)" />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox ID="cbChoose" runat="server" onclick="CheckSingle(this)" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderStyle-CssClass="Hidden" ItemStyle-CssClass="Hidden" FooterStyle-CssClass="Hidden">
                        <HeaderTemplate>
                            ScheduleMatID
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblMatUseDetailID" runat="server" Text='<%#Eval("MatUseDetailID") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderStyle-CssClass="Hidden" ItemStyle-CssClass="Hidden" FooterStyle-CssClass="Hidden">
                        <HeaderTemplate>
                            SingleMMNumber
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblSingleMMNumber" runat="server" Text='<%#Eval("SingleMMNumber") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            原料编号
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblMaterialID" runat="server" Text='<%#Eval("MaterialID") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            原料品名
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblMaterialName" runat="server" Text='<%#Eval("MaterialName") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            规格
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblSpecifications" runat="server" Text='<%#Eval("Specifications") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            单位
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblUnit" runat="server" Text='<%#Eval("Unit") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            变更数量
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblChangeNum" runat="server" Text='<%#Eval("ChangeNum") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            领料数量
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblUseNums" runat="server" Text='<%#Eval("UseNums") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            剩余数量
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblLeftNums" runat="server" Text='<%#Eval("LeftNums") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <HeaderTemplate>
                            库存数量
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblStockNums" runat="server" Text='<%#Eval("StockNums") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:SGridView>
            <div style="padding-top: 5px" align="right">
                <cc1:PagingControl ID="pcData" runat="server" OnPageIndexClick="pcData_PageIndexClick" />
            </div>
        </div>
        <div class="tableStyle2">
            <div class="controlBar" style="padding-right: 300px;">
                <label class="btnStyleb png_bg">
                    <asp:Button ID="btnOk" runat="server" Text="确认" OnClick="btnOk_Click" />
                </label>
                <label class="btnStyleb png_bg">
                    <input id="btnBack" type="button" value="取消" onclick="CloseTopDialog();" />
                </label>
            </div>
        </div>
    </div>
</asp:Content>

